extends layout

block content
    // 传递参数
    dashboardClass = true
    include common/_admin_navbar
    .content
        .header
            h1.page-title 博文热度
        ul.breadcrumb
            li.active 首页
        .container-fluid
            .row-fluid
                .well
                    #container(style='min-width: 310px; height: 400px; margin: 0 auto')

            include common/_admin_footer

block script
    script(src='#{options.cdn_path}/js/highcharts/highcharts.js?v=#{options.site_version}')
    script(src='#{options.cdn_path}/js/highcharts/modules/exporting.js?v=#{options.site_version}')
    script(type='text/javascript')
        $(function () {
            $('#container').highcharts({
                chart: {
                    type: 'scatter',
                    zoomType: 'xy'
                },
                title: {
                    text: '博文热度图'
                },
                subtitle: {
                    text: '#{options.site_url}',
                },
                credits: {
                    enabled: false
                },
                xAxis: {
                    title: {
                        enabled: true,
                        text: '博文id'
                    },
                    startOnTick: true,
                    endOnTick: true,
                    showLastLabel: true
                },
                yAxis: {
                    title: {
                        text: '阅读数 （次）'
                    }
                },
                legend: {
                    layout: 'vertical',
                    align: 'left',
                    verticalAlign: 'top',
                    x: 100,
                    y: 70,
                    floating: true,
                    backgroundColor: '#FFFFFF',
                    borderWidth: 1
                },
                plotOptions: {
                    scatter: {
                        marker: {
                            radius: 5,
                            states: {
                                hover: {
                                    enabled: true,
                                    lineColor: 'rgb(100,100,100)'
                                }
                            }
                        },
                        states: {
                            hover: {
                                marker: {
                                    enabled: false
                                }
                            }
                        },
                        tooltip: {
                            headerFormat: '<b>{series.name}</b><br>',
                            pointFormat: 'ID:{point.x}, {point.y} 次'
                        }
                    }
                },
                series: [{
                    name: '统计',
                    color: 'rgba(223, 83, 83, .5)',
                    data: $.parseJSON('#{data}')
                }]
            });
        });